﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;
using System.Web.UI.WebControls;
using Gencode.Common.SQL;

namespace Gencode.PrsWeb.App
{
	public class ListDataGenerator
	{
        [System.Obsolete("PrsCommon.App.AppData.DataGenerator.GetDienste",true)]
		public static DataView FillListDienste(ref ListBox list, string mandid, bool addEmptyRow)
		{
			DataView dv = FillListDienste(mandid, addEmptyRow);
            
			list.DataSource = dv;
			list.DataValueField = "Anzeigename";
			list.DataBind();

			return dv;
		}

		public static DataView FillListDienste(string mandid, bool addEmptyRow)
		{
			Querry querry = new Querry();
			querry.SetSTPName("get_dienstlisting");
			querry.AddParameter("@mandid", mandid);

			DataView dv = querry.ExecuteForDataView();

			if (addEmptyRow)
			{
				DataRow row = dv.Table.NewRow();
				dv.Table.Rows.InsertAt(row, 0);
			}

			return dv;
		}
	}
}
